require('./PageTender.styl');
import { Control } from 'react-keeper';

const GirdView = require('components/girdview');
const Panel = require('components/panel');
const Menu = require('components/menu');
const ui = require('clientConfig/util/jsapi/ui');
// var paths = [{ path: "tender", title: "招标管理", id: 'index0', tabTitles: "招标审批 招标进度" }];
var paths = [{ path: "tender", title: "招标管理", id: 'index0'}];
class Tender extends React.Component {

    constructor(props) {
        super(props);
        this.state = {
        };
        this.action = [
            {
                content: '招标需求',
                icon: "tender/tenderplan.svg",
                path: "/home/tender/tenderplan"
            },
            {
                content: '采购方式',
                icon: "tender/procure.svg",
                path: "/home/tender/tenderprocure"
            },{
                content: '采购结果',
                icon: "tender/procureresult.svg",
                path: "/home/tender/tenderpurchase"
            },{
                content: '合同签订',
                icon: "tender/contractsign.svg",
                path: "/home/tender/contractsign",
            }
        ];
        // if (Control.state){
        //     if(Control.state.origin_title=="招标进度"){
        //         this.activenum = 0; 
        //         paths = [{ path: "tender", title: "招标管理", id: 'index0', tabTitles: "招标进度" }];                
        //     }              
        // }else{
        //     this.activenum = 0;
        //     paths = [{ path: "tender", title: "招标管理", id: 'index0', tabTitles: "招标审批 招标进度" }];                            
        // }  
        this.handlePlusClick = this.handlePlusClick.bind(this);
    }
    handlePlusClick() {
        this.setState({
            show: true,
        })
    }
    render() {
        let girdItems = [{ title: "待我审批的", hashPath: "/home/tender/pending", src: "pending", homesvg: 'workplan0_svg1' }, { title: "我发起的", hashPath: "/home/tender/sponsored", src: "sponsored", homesvg: "workplan0_svg2" }, { title: "抄送我的", hashPath: "/home/tender/copy", src: "copy", homesvg: "workplan0_svg3" },
        { title: "变更申请", hashPath: "/home/tender/changereq", src: "changereq", homesvg: "workplan0_svg4" }, { title: "变更记录", hashPath: "/home/tender/changerecord", src: "changerecord", homesvg: "workplan0_svg5" }];
        let pro_girdItems = [{ title: "项目总览", hashPath: "/home/tender/progresstrack", src: "progresstrack", homesvg: 'workplan1_svg1' }, { title: "单个项目", hashPath: "/home/tender/singleproject", src: "singleproject", homesvg: "workplan1_svg2" }];
        return (
            <div className="tender">
                {paths.map((item, index) => {
                    const ContentSvg = require(`images/svg/mangement/${item.path}.svg`);
                    return (
                        <Panel title={item.title} Key={item.path} active activenum={this.activenum} tabTitles={item.tabTitles} cbPlus={this.handlePlusClick}>
                            <ContentSvg className="content-svg"/>
                            {/* {!Control.state && <GirdView girdItems={girdItems} path={item.path} />}
                            <GirdView girdItems={pro_girdItems} path={item.path} /> */}
                        </Panel>);
                })
                }
                <GirdView girdItems={girdItems} path={paths[0].path} />
                <Menu item={this.action} show={this.state.show} />
            </div>
        );
    }

    componentWillMount() {
        ui.setTitle({ title: "IT项目管理信息系统" });
    }

    componentDidMount() {

    }

    componentWillReceiveProps(nextProps) {
    }

    shouldComponentUpdate(nextProps, nextState) {
        return true;
    }

    componentWillUpdate(nextProps, nextState) {
    }

    componentDidUpdate(prevProps, prevState) {
    }

    componentWillUnmount() {
    }
}
module.exports = Tender;
